package com.xuecheng.base.exception;


import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel("自定义的异常类,继承 RuntimeException")
public class XueChengPlusException extends RuntimeException {

   private String errMessage;

   public XueChengPlusException() {
      super();
   }

   public XueChengPlusException(String errMessage) {
      super(errMessage);
      this.errMessage = errMessage;
   }

   public String getErrMessage() {
      return errMessage;
   }

   @ApiModelProperty("静态方法:抛出一个'枚举信息'的自定义异常")
   public static void cast(CommonError commonError){
       throw new XueChengPlusException(commonError.getErrMessage());
   }

   @ApiModelProperty("静态方法重载:抛出一个普通的自定义异常")
   public static void cast(String errMessage){
       throw new XueChengPlusException(errMessage);
   }

}